
/*
'===============================================================================
'  Generated From - CSharp_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Specialized;

using MyGeneration.dOOdads;

namespace POSSystem.DAL
{
	public abstract class _Invoices : SqlClientEntity
	{
		public _Invoices()
		{
			this.QuerySource = "Invoices";
			this.MappingName = "Invoices";

		}	

		//=================================================================
		//  public Overrides void AddNew()
		//=================================================================
		//
		//=================================================================
		public override void AddNew()
		{
			base.AddNew();
			
		}
		
		
		public override void FlushData()
		{
			this._whereClause = null;
			this._aggregateClause = null;
			base.FlushData();
		}
		
		//=================================================================
		//  	public Function LoadAll() As Boolean
		//=================================================================
		//  Loads all of the records in the database, and sets the currentRow to the first row
		//=================================================================
		public bool LoadAll() 
		{
			ListDictionary parameters = null;
			
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_InvoicesLoadAll]", parameters);
		}
	
		//=================================================================
		// public Overridable Function LoadByPrimaryKey()  As Boolean
		//=================================================================
		//  Loads a single row of via the primary key
		//=================================================================
		public virtual bool LoadByPrimaryKey(int ID)
		{
			ListDictionary parameters = new ListDictionary();
			parameters.Add(Parameters.ID, ID);

		
			return base.LoadFromSql("[" + this.SchemaStoredProcedure + "proc_InvoicesLoadByPrimaryKey]", parameters);
		}
		
		#region Parameters
		protected class Parameters
		{
			
			public static SqlParameter ID
			{
				get
				{
					return new SqlParameter("@ID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter InvoiceNo
			{
				get
				{
					return new SqlParameter("@InvoiceNo", SqlDbType.Char, 10);
				}
			}
			
			public static SqlParameter InvoiceTypeID
			{
				get
				{
					return new SqlParameter("@InvoiceTypeID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter SaleUser
			{
				get
				{
					return new SqlParameter("@SaleUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CustomerID
			{
				get
				{
					return new SqlParameter("@CustomerID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CustomerName
			{
				get
				{
					return new SqlParameter("@CustomerName", SqlDbType.NVarChar, 50);
				}
			}
			
			public static SqlParameter GSTTotalAmount
			{
				get
				{
					return new SqlParameter("@GSTTotalAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter TotalAmount
			{
				get
				{
					return new SqlParameter("@TotalAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter PaidAmount
			{
				get
				{
					return new SqlParameter("@PaidAmount", SqlDbType.Decimal, 0);
				}
			}
			
			public static SqlParameter Note
			{
				get
				{
					return new SqlParameter("@Note", SqlDbType.NVarChar, 500);
				}
			}
			
			public static SqlParameter Deleted
			{
				get
				{
					return new SqlParameter("@Deleted", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter LastModifiedDate
			{
				get
				{
					return new SqlParameter("@LastModifiedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter LastModifiedByUser
			{
				get
				{
					return new SqlParameter("@LastModifiedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter CreatedDate
			{
				get
				{
					return new SqlParameter("@CreatedDate", SqlDbType.DateTime, 0);
				}
			}
			
			public static SqlParameter CreatedByUser
			{
				get
				{
					return new SqlParameter("@CreatedByUser", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter IsRetail
			{
				get
				{
					return new SqlParameter("@IsRetail", SqlDbType.Bit, 0);
				}
			}
			
			public static SqlParameter InvoiceCategory
			{
				get
				{
					return new SqlParameter("@InvoiceCategory", SqlDbType.TinyInt, 0);
				}
			}
			
			public static SqlParameter BranchID
			{
				get
				{
					return new SqlParameter("@BranchID", SqlDbType.Int, 0);
				}
			}
			
			public static SqlParameter VoucherID
			{
				get
				{
					return new SqlParameter("@VoucherID", SqlDbType.UniqueIdentifier, 0);
				}
			}
			
			public static SqlParameter SpecialDiscount
			{
				get
				{
					return new SqlParameter("@SpecialDiscount", SqlDbType.Decimal, 0);
				}
			}
			
		}
		#endregion		
	
		#region ColumnNames
		public class ColumnNames
		{  
            public const string ID = "ID";
            public const string InvoiceNo = "InvoiceNo";
            public const string InvoiceTypeID = "InvoiceTypeID";
            public const string SaleUser = "SaleUser";
            public const string CustomerID = "CustomerID";
            public const string CustomerName = "CustomerName";
            public const string GSTTotalAmount = "GSTTotalAmount";
            public const string TotalAmount = "TotalAmount";
            public const string PaidAmount = "PaidAmount";
            public const string Note = "Note";
            public const string Deleted = "Deleted";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string CreatedDate = "CreatedDate";
            public const string CreatedByUser = "CreatedByUser";
            public const string IsRetail = "IsRetail";
            public const string InvoiceCategory = "InvoiceCategory";
            public const string BranchID = "BranchID";
            public const string VoucherID = "VoucherID";
            public const string SpecialDiscount = "SpecialDiscount";

			static public string ToPropertyName(string columnName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Invoices.PropertyNames.ID;
					ht[InvoiceNo] = _Invoices.PropertyNames.InvoiceNo;
					ht[InvoiceTypeID] = _Invoices.PropertyNames.InvoiceTypeID;
					ht[SaleUser] = _Invoices.PropertyNames.SaleUser;
					ht[CustomerID] = _Invoices.PropertyNames.CustomerID;
					ht[CustomerName] = _Invoices.PropertyNames.CustomerName;
					ht[GSTTotalAmount] = _Invoices.PropertyNames.GSTTotalAmount;
					ht[TotalAmount] = _Invoices.PropertyNames.TotalAmount;
					ht[PaidAmount] = _Invoices.PropertyNames.PaidAmount;
					ht[Note] = _Invoices.PropertyNames.Note;
					ht[Deleted] = _Invoices.PropertyNames.Deleted;
					ht[LastModifiedDate] = _Invoices.PropertyNames.LastModifiedDate;
					ht[LastModifiedByUser] = _Invoices.PropertyNames.LastModifiedByUser;
					ht[CreatedDate] = _Invoices.PropertyNames.CreatedDate;
					ht[CreatedByUser] = _Invoices.PropertyNames.CreatedByUser;
					ht[IsRetail] = _Invoices.PropertyNames.IsRetail;
					ht[InvoiceCategory] = _Invoices.PropertyNames.InvoiceCategory;
					ht[BranchID] = _Invoices.PropertyNames.BranchID;
					ht[VoucherID] = _Invoices.PropertyNames.VoucherID;
					ht[SpecialDiscount] = _Invoices.PropertyNames.SpecialDiscount;

				}
				return (string)ht[columnName];
			}

			static private Hashtable ht = null;			 
		}
		#endregion
		
		#region PropertyNames
		public class PropertyNames
		{  
            public const string ID = "ID";
            public const string InvoiceNo = "InvoiceNo";
            public const string InvoiceTypeID = "InvoiceTypeID";
            public const string SaleUser = "SaleUser";
            public const string CustomerID = "CustomerID";
            public const string CustomerName = "CustomerName";
            public const string GSTTotalAmount = "GSTTotalAmount";
            public const string TotalAmount = "TotalAmount";
            public const string PaidAmount = "PaidAmount";
            public const string Note = "Note";
            public const string Deleted = "Deleted";
            public const string LastModifiedDate = "LastModifiedDate";
            public const string LastModifiedByUser = "LastModifiedByUser";
            public const string CreatedDate = "CreatedDate";
            public const string CreatedByUser = "CreatedByUser";
            public const string IsRetail = "IsRetail";
            public const string InvoiceCategory = "InvoiceCategory";
            public const string BranchID = "BranchID";
            public const string VoucherID = "VoucherID";
            public const string SpecialDiscount = "SpecialDiscount";

			static public string ToColumnName(string propertyName)
			{
				if(ht == null)
				{
					ht = new Hashtable();
					
					ht[ID] = _Invoices.ColumnNames.ID;
					ht[InvoiceNo] = _Invoices.ColumnNames.InvoiceNo;
					ht[InvoiceTypeID] = _Invoices.ColumnNames.InvoiceTypeID;
					ht[SaleUser] = _Invoices.ColumnNames.SaleUser;
					ht[CustomerID] = _Invoices.ColumnNames.CustomerID;
					ht[CustomerName] = _Invoices.ColumnNames.CustomerName;
					ht[GSTTotalAmount] = _Invoices.ColumnNames.GSTTotalAmount;
					ht[TotalAmount] = _Invoices.ColumnNames.TotalAmount;
					ht[PaidAmount] = _Invoices.ColumnNames.PaidAmount;
					ht[Note] = _Invoices.ColumnNames.Note;
					ht[Deleted] = _Invoices.ColumnNames.Deleted;
					ht[LastModifiedDate] = _Invoices.ColumnNames.LastModifiedDate;
					ht[LastModifiedByUser] = _Invoices.ColumnNames.LastModifiedByUser;
					ht[CreatedDate] = _Invoices.ColumnNames.CreatedDate;
					ht[CreatedByUser] = _Invoices.ColumnNames.CreatedByUser;
					ht[IsRetail] = _Invoices.ColumnNames.IsRetail;
					ht[InvoiceCategory] = _Invoices.ColumnNames.InvoiceCategory;
					ht[BranchID] = _Invoices.ColumnNames.BranchID;
					ht[VoucherID] = _Invoices.ColumnNames.VoucherID;
					ht[SpecialDiscount] = _Invoices.ColumnNames.SpecialDiscount;

				}
				return (string)ht[propertyName];
			}

			static private Hashtable ht = null;			 
		}			 
		#endregion	

		#region StringPropertyNames
		public class StringPropertyNames
		{  
            public const string ID = "s_ID";
            public const string InvoiceNo = "s_InvoiceNo";
            public const string InvoiceTypeID = "s_InvoiceTypeID";
            public const string SaleUser = "s_SaleUser";
            public const string CustomerID = "s_CustomerID";
            public const string CustomerName = "s_CustomerName";
            public const string GSTTotalAmount = "s_GSTTotalAmount";
            public const string TotalAmount = "s_TotalAmount";
            public const string PaidAmount = "s_PaidAmount";
            public const string Note = "s_Note";
            public const string Deleted = "s_Deleted";
            public const string LastModifiedDate = "s_LastModifiedDate";
            public const string LastModifiedByUser = "s_LastModifiedByUser";
            public const string CreatedDate = "s_CreatedDate";
            public const string CreatedByUser = "s_CreatedByUser";
            public const string IsRetail = "s_IsRetail";
            public const string InvoiceCategory = "s_InvoiceCategory";
            public const string BranchID = "s_BranchID";
            public const string VoucherID = "s_VoucherID";
            public const string SpecialDiscount = "s_SpecialDiscount";

		}
		#endregion		
		
		#region Properties
	
		public virtual int ID
	    {
			get
	        {
				return base.Getint(ColumnNames.ID);
			}
			set
	        {
				base.Setint(ColumnNames.ID, value);
			}
		}

		public virtual string InvoiceNo
	    {
			get
	        {
				return base.Getstring(ColumnNames.InvoiceNo);
			}
			set
	        {
				base.Setstring(ColumnNames.InvoiceNo, value);
			}
		}

		public virtual int InvoiceTypeID
	    {
			get
	        {
				return base.Getint(ColumnNames.InvoiceTypeID);
			}
			set
	        {
				base.Setint(ColumnNames.InvoiceTypeID, value);
			}
		}

		public virtual int SaleUser
	    {
			get
	        {
				return base.Getint(ColumnNames.SaleUser);
			}
			set
	        {
				base.Setint(ColumnNames.SaleUser, value);
			}
		}

		public virtual int CustomerID
	    {
			get
	        {
				return base.Getint(ColumnNames.CustomerID);
			}
			set
	        {
				base.Setint(ColumnNames.CustomerID, value);
			}
		}

		public virtual string CustomerName
	    {
			get
	        {
				return base.Getstring(ColumnNames.CustomerName);
			}
			set
	        {
				base.Setstring(ColumnNames.CustomerName, value);
			}
		}

		public virtual decimal GSTTotalAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.GSTTotalAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.GSTTotalAmount, value);
			}
		}

		public virtual decimal TotalAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.TotalAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.TotalAmount, value);
			}
		}

		public virtual decimal PaidAmount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.PaidAmount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.PaidAmount, value);
			}
		}

		public virtual string Note
	    {
			get
	        {
				return base.Getstring(ColumnNames.Note);
			}
			set
	        {
				base.Setstring(ColumnNames.Note, value);
			}
		}

		public virtual bool Deleted
	    {
			get
	        {
				return base.Getbool(ColumnNames.Deleted);
			}
			set
	        {
				base.Setbool(ColumnNames.Deleted, value);
			}
		}

		public virtual DateTime LastModifiedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.LastModifiedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual int LastModifiedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual DateTime CreatedDate
	    {
			get
	        {
				return base.GetDateTime(ColumnNames.CreatedDate);
			}
			set
	        {
				base.SetDateTime(ColumnNames.CreatedDate, value);
			}
		}

		public virtual int CreatedByUser
	    {
			get
	        {
				return base.Getint(ColumnNames.CreatedByUser);
			}
			set
	        {
				base.Setint(ColumnNames.CreatedByUser, value);
			}
		}

		public virtual bool IsRetail
	    {
			get
	        {
				return base.Getbool(ColumnNames.IsRetail);
			}
			set
	        {
				base.Setbool(ColumnNames.IsRetail, value);
			}
		}

		public virtual byte InvoiceCategory
	    {
			get
	        {
				return base.Getbyte(ColumnNames.InvoiceCategory);
			}
			set
	        {
				base.Setbyte(ColumnNames.InvoiceCategory, value);
			}
		}

		public virtual int BranchID
	    {
			get
	        {
				return base.Getint(ColumnNames.BranchID);
			}
			set
	        {
				base.Setint(ColumnNames.BranchID, value);
			}
		}

		public virtual Guid VoucherID
	    {
			get
	        {
				return base.GetGuid(ColumnNames.VoucherID);
			}
			set
	        {
				base.SetGuid(ColumnNames.VoucherID, value);
			}
		}

		public virtual decimal SpecialDiscount
	    {
			get
	        {
				return base.Getdecimal(ColumnNames.SpecialDiscount);
			}
			set
	        {
				base.Setdecimal(ColumnNames.SpecialDiscount, value);
			}
		}


		#endregion
		
		#region String Properties
	
		public virtual string s_ID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.ID) ? string.Empty : base.GetintAsString(ColumnNames.ID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.ID);
				else
					this.ID = base.SetintAsString(ColumnNames.ID, value);
			}
		}

		public virtual string s_InvoiceNo
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.InvoiceNo) ? string.Empty : base.GetstringAsString(ColumnNames.InvoiceNo);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.InvoiceNo);
				else
					this.InvoiceNo = base.SetstringAsString(ColumnNames.InvoiceNo, value);
			}
		}

		public virtual string s_InvoiceTypeID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.InvoiceTypeID) ? string.Empty : base.GetintAsString(ColumnNames.InvoiceTypeID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.InvoiceTypeID);
				else
					this.InvoiceTypeID = base.SetintAsString(ColumnNames.InvoiceTypeID, value);
			}
		}

		public virtual string s_SaleUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SaleUser) ? string.Empty : base.GetintAsString(ColumnNames.SaleUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SaleUser);
				else
					this.SaleUser = base.SetintAsString(ColumnNames.SaleUser, value);
			}
		}

		public virtual string s_CustomerID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerID) ? string.Empty : base.GetintAsString(ColumnNames.CustomerID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerID);
				else
					this.CustomerID = base.SetintAsString(ColumnNames.CustomerID, value);
			}
		}

		public virtual string s_CustomerName
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CustomerName) ? string.Empty : base.GetstringAsString(ColumnNames.CustomerName);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CustomerName);
				else
					this.CustomerName = base.SetstringAsString(ColumnNames.CustomerName, value);
			}
		}

		public virtual string s_GSTTotalAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.GSTTotalAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.GSTTotalAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.GSTTotalAmount);
				else
					this.GSTTotalAmount = base.SetdecimalAsString(ColumnNames.GSTTotalAmount, value);
			}
		}

		public virtual string s_TotalAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.TotalAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.TotalAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.TotalAmount);
				else
					this.TotalAmount = base.SetdecimalAsString(ColumnNames.TotalAmount, value);
			}
		}

		public virtual string s_PaidAmount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.PaidAmount) ? string.Empty : base.GetdecimalAsString(ColumnNames.PaidAmount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.PaidAmount);
				else
					this.PaidAmount = base.SetdecimalAsString(ColumnNames.PaidAmount, value);
			}
		}

		public virtual string s_Note
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Note) ? string.Empty : base.GetstringAsString(ColumnNames.Note);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Note);
				else
					this.Note = base.SetstringAsString(ColumnNames.Note, value);
			}
		}

		public virtual string s_Deleted
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.Deleted) ? string.Empty : base.GetboolAsString(ColumnNames.Deleted);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.Deleted);
				else
					this.Deleted = base.SetboolAsString(ColumnNames.Deleted, value);
			}
		}

		public virtual string s_LastModifiedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.LastModifiedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedDate);
				else
					this.LastModifiedDate = base.SetDateTimeAsString(ColumnNames.LastModifiedDate, value);
			}
		}

		public virtual string s_LastModifiedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.LastModifiedByUser) ? string.Empty : base.GetintAsString(ColumnNames.LastModifiedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.LastModifiedByUser);
				else
					this.LastModifiedByUser = base.SetintAsString(ColumnNames.LastModifiedByUser, value);
			}
		}

		public virtual string s_CreatedDate
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedDate) ? string.Empty : base.GetDateTimeAsString(ColumnNames.CreatedDate);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedDate);
				else
					this.CreatedDate = base.SetDateTimeAsString(ColumnNames.CreatedDate, value);
			}
		}

		public virtual string s_CreatedByUser
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.CreatedByUser) ? string.Empty : base.GetintAsString(ColumnNames.CreatedByUser);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.CreatedByUser);
				else
					this.CreatedByUser = base.SetintAsString(ColumnNames.CreatedByUser, value);
			}
		}

		public virtual string s_IsRetail
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.IsRetail) ? string.Empty : base.GetboolAsString(ColumnNames.IsRetail);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.IsRetail);
				else
					this.IsRetail = base.SetboolAsString(ColumnNames.IsRetail, value);
			}
		}

		public virtual string s_InvoiceCategory
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.InvoiceCategory) ? string.Empty : base.GetbyteAsString(ColumnNames.InvoiceCategory);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.InvoiceCategory);
				else
					this.InvoiceCategory = base.SetbyteAsString(ColumnNames.InvoiceCategory, value);
			}
		}

		public virtual string s_BranchID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.BranchID) ? string.Empty : base.GetintAsString(ColumnNames.BranchID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.BranchID);
				else
					this.BranchID = base.SetintAsString(ColumnNames.BranchID, value);
			}
		}

		public virtual string s_VoucherID
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.VoucherID) ? string.Empty : base.GetGuidAsString(ColumnNames.VoucherID);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.VoucherID);
				else
					this.VoucherID = base.SetGuidAsString(ColumnNames.VoucherID, value);
			}
		}

		public virtual string s_SpecialDiscount
	    {
			get
	        {
				return this.IsColumnNull(ColumnNames.SpecialDiscount) ? string.Empty : base.GetdecimalAsString(ColumnNames.SpecialDiscount);
			}
			set
	        {
				if(string.Empty == value)
					this.SetColumnNull(ColumnNames.SpecialDiscount);
				else
					this.SpecialDiscount = base.SetdecimalAsString(ColumnNames.SpecialDiscount, value);
			}
		}


		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region WhereParameter TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter ID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter InvoiceNo
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.InvoiceNo, Parameters.InvoiceNo);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter InvoiceTypeID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.InvoiceTypeID, Parameters.InvoiceTypeID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SaleUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SaleUser, Parameters.SaleUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CustomerName
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CustomerName, Parameters.CustomerName);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter GSTTotalAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.GSTTotalAmount, Parameters.GSTTotalAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter TotalAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.TotalAmount, Parameters.TotalAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter PaidAmount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.PaidAmount, Parameters.PaidAmount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Note
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Note, Parameters.Note);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter Deleted
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter LastModifiedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter CreatedByUser
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.CreatedByUser, Parameters.CreatedByUser);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter IsRetail
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.IsRetail, Parameters.IsRetail);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter InvoiceCategory
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.InvoiceCategory, Parameters.InvoiceCategory);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter BranchID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter VoucherID
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.VoucherID, Parameters.VoucherID);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}

				public WhereParameter SpecialDiscount
				{
					get
					{
							WhereParameter where = new WhereParameter(ColumnNames.SpecialDiscount, Parameters.SpecialDiscount);
							this._clause._entity.Query.AddWhereParameter(where);
							return where;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public WhereParameter InvoiceNo
		    {
				get
		        {
					if(_InvoiceNo_W == null)
	        	    {
						_InvoiceNo_W = TearOff.InvoiceNo;
					}
					return _InvoiceNo_W;
				}
			}

			public WhereParameter InvoiceTypeID
		    {
				get
		        {
					if(_InvoiceTypeID_W == null)
	        	    {
						_InvoiceTypeID_W = TearOff.InvoiceTypeID;
					}
					return _InvoiceTypeID_W;
				}
			}

			public WhereParameter SaleUser
		    {
				get
		        {
					if(_SaleUser_W == null)
	        	    {
						_SaleUser_W = TearOff.SaleUser;
					}
					return _SaleUser_W;
				}
			}

			public WhereParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public WhereParameter CustomerName
		    {
				get
		        {
					if(_CustomerName_W == null)
	        	    {
						_CustomerName_W = TearOff.CustomerName;
					}
					return _CustomerName_W;
				}
			}

			public WhereParameter GSTTotalAmount
		    {
				get
		        {
					if(_GSTTotalAmount_W == null)
	        	    {
						_GSTTotalAmount_W = TearOff.GSTTotalAmount;
					}
					return _GSTTotalAmount_W;
				}
			}

			public WhereParameter TotalAmount
		    {
				get
		        {
					if(_TotalAmount_W == null)
	        	    {
						_TotalAmount_W = TearOff.TotalAmount;
					}
					return _TotalAmount_W;
				}
			}

			public WhereParameter PaidAmount
		    {
				get
		        {
					if(_PaidAmount_W == null)
	        	    {
						_PaidAmount_W = TearOff.PaidAmount;
					}
					return _PaidAmount_W;
				}
			}

			public WhereParameter Note
		    {
				get
		        {
					if(_Note_W == null)
	        	    {
						_Note_W = TearOff.Note;
					}
					return _Note_W;
				}
			}

			public WhereParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public WhereParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public WhereParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter CreatedByUser
		    {
				get
		        {
					if(_CreatedByUser_W == null)
	        	    {
						_CreatedByUser_W = TearOff.CreatedByUser;
					}
					return _CreatedByUser_W;
				}
			}

			public WhereParameter IsRetail
		    {
				get
		        {
					if(_IsRetail_W == null)
	        	    {
						_IsRetail_W = TearOff.IsRetail;
					}
					return _IsRetail_W;
				}
			}

			public WhereParameter InvoiceCategory
		    {
				get
		        {
					if(_InvoiceCategory_W == null)
	        	    {
						_InvoiceCategory_W = TearOff.InvoiceCategory;
					}
					return _InvoiceCategory_W;
				}
			}

			public WhereParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			public WhereParameter VoucherID
		    {
				get
		        {
					if(_VoucherID_W == null)
	        	    {
						_VoucherID_W = TearOff.VoucherID;
					}
					return _VoucherID_W;
				}
			}

			public WhereParameter SpecialDiscount
		    {
				get
		        {
					if(_SpecialDiscount_W == null)
	        	    {
						_SpecialDiscount_W = TearOff.SpecialDiscount;
					}
					return _SpecialDiscount_W;
				}
			}

			private WhereParameter _ID_W = null;
			private WhereParameter _InvoiceNo_W = null;
			private WhereParameter _InvoiceTypeID_W = null;
			private WhereParameter _SaleUser_W = null;
			private WhereParameter _CustomerID_W = null;
			private WhereParameter _CustomerName_W = null;
			private WhereParameter _GSTTotalAmount_W = null;
			private WhereParameter _TotalAmount_W = null;
			private WhereParameter _PaidAmount_W = null;
			private WhereParameter _Note_W = null;
			private WhereParameter _Deleted_W = null;
			private WhereParameter _LastModifiedDate_W = null;
			private WhereParameter _LastModifiedByUser_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _CreatedByUser_W = null;
			private WhereParameter _IsRetail_W = null;
			private WhereParameter _InvoiceCategory_W = null;
			private WhereParameter _BranchID_W = null;
			private WhereParameter _VoucherID_W = null;
			private WhereParameter _SpecialDiscount_W = null;

			public void WhereClauseReset()
			{
				_ID_W = null;
				_InvoiceNo_W = null;
				_InvoiceTypeID_W = null;
				_SaleUser_W = null;
				_CustomerID_W = null;
				_CustomerName_W = null;
				_GSTTotalAmount_W = null;
				_TotalAmount_W = null;
				_PaidAmount_W = null;
				_Note_W = null;
				_Deleted_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_CreatedDate_W = null;
				_CreatedByUser_W = null;
				_IsRetail_W = null;
				_InvoiceCategory_W = null;
				_BranchID_W = null;
				_VoucherID_W = null;
				_SpecialDiscount_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
	
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(BusinessEntity entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region AggregateParameter TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter ID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.ID, Parameters.ID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter InvoiceNo
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.InvoiceNo, Parameters.InvoiceNo);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter InvoiceTypeID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.InvoiceTypeID, Parameters.InvoiceTypeID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SaleUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SaleUser, Parameters.SaleUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerID, Parameters.CustomerID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CustomerName
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CustomerName, Parameters.CustomerName);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter GSTTotalAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.GSTTotalAmount, Parameters.GSTTotalAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter TotalAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.TotalAmount, Parameters.TotalAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter PaidAmount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.PaidAmount, Parameters.PaidAmount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Note
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Note, Parameters.Note);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter Deleted
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.Deleted, Parameters.Deleted);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedDate, Parameters.LastModifiedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter LastModifiedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.LastModifiedByUser, Parameters.LastModifiedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedDate, Parameters.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter CreatedByUser
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.CreatedByUser, Parameters.CreatedByUser);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter IsRetail
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.IsRetail, Parameters.IsRetail);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter InvoiceCategory
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.InvoiceCategory, Parameters.InvoiceCategory);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter BranchID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.BranchID, Parameters.BranchID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter VoucherID
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.VoucherID, Parameters.VoucherID);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}

				public AggregateParameter SpecialDiscount
				{
					get
					{
							AggregateParameter aggregate = new AggregateParameter(ColumnNames.SpecialDiscount, Parameters.SpecialDiscount);
							this._clause._entity.Query.AddAggregateParameter(aggregate);
							return aggregate;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter ID
		    {
				get
		        {
					if(_ID_W == null)
	        	    {
						_ID_W = TearOff.ID;
					}
					return _ID_W;
				}
			}

			public AggregateParameter InvoiceNo
		    {
				get
		        {
					if(_InvoiceNo_W == null)
	        	    {
						_InvoiceNo_W = TearOff.InvoiceNo;
					}
					return _InvoiceNo_W;
				}
			}

			public AggregateParameter InvoiceTypeID
		    {
				get
		        {
					if(_InvoiceTypeID_W == null)
	        	    {
						_InvoiceTypeID_W = TearOff.InvoiceTypeID;
					}
					return _InvoiceTypeID_W;
				}
			}

			public AggregateParameter SaleUser
		    {
				get
		        {
					if(_SaleUser_W == null)
	        	    {
						_SaleUser_W = TearOff.SaleUser;
					}
					return _SaleUser_W;
				}
			}

			public AggregateParameter CustomerID
		    {
				get
		        {
					if(_CustomerID_W == null)
	        	    {
						_CustomerID_W = TearOff.CustomerID;
					}
					return _CustomerID_W;
				}
			}

			public AggregateParameter CustomerName
		    {
				get
		        {
					if(_CustomerName_W == null)
	        	    {
						_CustomerName_W = TearOff.CustomerName;
					}
					return _CustomerName_W;
				}
			}

			public AggregateParameter GSTTotalAmount
		    {
				get
		        {
					if(_GSTTotalAmount_W == null)
	        	    {
						_GSTTotalAmount_W = TearOff.GSTTotalAmount;
					}
					return _GSTTotalAmount_W;
				}
			}

			public AggregateParameter TotalAmount
		    {
				get
		        {
					if(_TotalAmount_W == null)
	        	    {
						_TotalAmount_W = TearOff.TotalAmount;
					}
					return _TotalAmount_W;
				}
			}

			public AggregateParameter PaidAmount
		    {
				get
		        {
					if(_PaidAmount_W == null)
	        	    {
						_PaidAmount_W = TearOff.PaidAmount;
					}
					return _PaidAmount_W;
				}
			}

			public AggregateParameter Note
		    {
				get
		        {
					if(_Note_W == null)
	        	    {
						_Note_W = TearOff.Note;
					}
					return _Note_W;
				}
			}

			public AggregateParameter Deleted
		    {
				get
		        {
					if(_Deleted_W == null)
	        	    {
						_Deleted_W = TearOff.Deleted;
					}
					return _Deleted_W;
				}
			}

			public AggregateParameter LastModifiedDate
		    {
				get
		        {
					if(_LastModifiedDate_W == null)
	        	    {
						_LastModifiedDate_W = TearOff.LastModifiedDate;
					}
					return _LastModifiedDate_W;
				}
			}

			public AggregateParameter LastModifiedByUser
		    {
				get
		        {
					if(_LastModifiedByUser_W == null)
	        	    {
						_LastModifiedByUser_W = TearOff.LastModifiedByUser;
					}
					return _LastModifiedByUser_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter CreatedByUser
		    {
				get
		        {
					if(_CreatedByUser_W == null)
	        	    {
						_CreatedByUser_W = TearOff.CreatedByUser;
					}
					return _CreatedByUser_W;
				}
			}

			public AggregateParameter IsRetail
		    {
				get
		        {
					if(_IsRetail_W == null)
	        	    {
						_IsRetail_W = TearOff.IsRetail;
					}
					return _IsRetail_W;
				}
			}

			public AggregateParameter InvoiceCategory
		    {
				get
		        {
					if(_InvoiceCategory_W == null)
	        	    {
						_InvoiceCategory_W = TearOff.InvoiceCategory;
					}
					return _InvoiceCategory_W;
				}
			}

			public AggregateParameter BranchID
		    {
				get
		        {
					if(_BranchID_W == null)
	        	    {
						_BranchID_W = TearOff.BranchID;
					}
					return _BranchID_W;
				}
			}

			public AggregateParameter VoucherID
		    {
				get
		        {
					if(_VoucherID_W == null)
	        	    {
						_VoucherID_W = TearOff.VoucherID;
					}
					return _VoucherID_W;
				}
			}

			public AggregateParameter SpecialDiscount
		    {
				get
		        {
					if(_SpecialDiscount_W == null)
	        	    {
						_SpecialDiscount_W = TearOff.SpecialDiscount;
					}
					return _SpecialDiscount_W;
				}
			}

			private AggregateParameter _ID_W = null;
			private AggregateParameter _InvoiceNo_W = null;
			private AggregateParameter _InvoiceTypeID_W = null;
			private AggregateParameter _SaleUser_W = null;
			private AggregateParameter _CustomerID_W = null;
			private AggregateParameter _CustomerName_W = null;
			private AggregateParameter _GSTTotalAmount_W = null;
			private AggregateParameter _TotalAmount_W = null;
			private AggregateParameter _PaidAmount_W = null;
			private AggregateParameter _Note_W = null;
			private AggregateParameter _Deleted_W = null;
			private AggregateParameter _LastModifiedDate_W = null;
			private AggregateParameter _LastModifiedByUser_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _CreatedByUser_W = null;
			private AggregateParameter _IsRetail_W = null;
			private AggregateParameter _InvoiceCategory_W = null;
			private AggregateParameter _BranchID_W = null;
			private AggregateParameter _VoucherID_W = null;
			private AggregateParameter _SpecialDiscount_W = null;

			public void AggregateClauseReset()
			{
				_ID_W = null;
				_InvoiceNo_W = null;
				_InvoiceTypeID_W = null;
				_SaleUser_W = null;
				_CustomerID_W = null;
				_CustomerName_W = null;
				_GSTTotalAmount_W = null;
				_TotalAmount_W = null;
				_PaidAmount_W = null;
				_Note_W = null;
				_Deleted_W = null;
				_LastModifiedDate_W = null;
				_LastModifiedByUser_W = null;
				_CreatedDate_W = null;
				_CreatedByUser_W = null;
				_IsRetail_W = null;
				_InvoiceCategory_W = null;
				_BranchID_W = null;
				_VoucherID_W = null;
				_SpecialDiscount_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private BusinessEntity _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	
		protected override IDbCommand GetInsertCommand() 
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_InvoicesInsert]";
	
			CreateParameters(cmd);
			
			SqlParameter p;
			p = cmd.Parameters[Parameters.ID.ParameterName];
			p.Direction = ParameterDirection.Output;
    
			return cmd;
		}
	
		protected override IDbCommand GetUpdateCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_InvoicesUpdate]";
	
			CreateParameters(cmd);
			      
			return cmd;
		}
	
		protected override IDbCommand GetDeleteCommand()
		{
		
			SqlCommand cmd = new SqlCommand();
			cmd.CommandType = CommandType.StoredProcedure;
			cmd.CommandText = "[" + this.SchemaStoredProcedure + "proc_InvoicesDelete]";
	
			SqlParameter p;
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

  
			return cmd;
		}
		
		private IDbCommand CreateParameters(SqlCommand cmd)
		{
			SqlParameter p;
		
			p = cmd.Parameters.Add(Parameters.ID);
			p.SourceColumn = ColumnNames.ID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.InvoiceNo);
			p.SourceColumn = ColumnNames.InvoiceNo;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.InvoiceTypeID);
			p.SourceColumn = ColumnNames.InvoiceTypeID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SaleUser);
			p.SourceColumn = ColumnNames.SaleUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerID);
			p.SourceColumn = ColumnNames.CustomerID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CustomerName);
			p.SourceColumn = ColumnNames.CustomerName;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.GSTTotalAmount);
			p.SourceColumn = ColumnNames.GSTTotalAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.TotalAmount);
			p.SourceColumn = ColumnNames.TotalAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.PaidAmount);
			p.SourceColumn = ColumnNames.PaidAmount;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Note);
			p.SourceColumn = ColumnNames.Note;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.Deleted);
			p.SourceColumn = ColumnNames.Deleted;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedDate);
			p.SourceColumn = ColumnNames.LastModifiedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.LastModifiedByUser);
			p.SourceColumn = ColumnNames.LastModifiedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedDate);
			p.SourceColumn = ColumnNames.CreatedDate;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.CreatedByUser);
			p.SourceColumn = ColumnNames.CreatedByUser;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.IsRetail);
			p.SourceColumn = ColumnNames.IsRetail;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.InvoiceCategory);
			p.SourceColumn = ColumnNames.InvoiceCategory;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.BranchID);
			p.SourceColumn = ColumnNames.BranchID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.VoucherID);
			p.SourceColumn = ColumnNames.VoucherID;
			p.SourceVersion = DataRowVersion.Current;

			p = cmd.Parameters.Add(Parameters.SpecialDiscount);
			p.SourceColumn = ColumnNames.SpecialDiscount;
			p.SourceVersion = DataRowVersion.Current;


			return cmd;
		}
	}
}
